<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>layedit</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../userRegisterAndLogin/css/oksub.css">
</head>
<body>
    <div class="ok-body" style="width:100px;">
        <textarea id="editor" style="display: none;"></textarea>
        <br/>
        <button type="button" class="layui-btn" id="textBtn">发布</button>
    </div>
    <!--js逻辑-->
    <script src="../userRegisterAndLogin/lib/layui/layui.js"></script>
    <script type="text/javascript">
        layui.use(["layedit"], function () {
            let $ = layui.jquery;
            let layedit = layui.layedit;

            let index = layedit.build("editor");

            $("#contentBtn").click(function () {
                alert(layedit.getContent(index));
            });

            $("#textBtn").click(function () {
                alert(layedit.getText(index));
            });

            $("#selectionBtn").click(function () {
                alert(layedit.getSelection(index));
            });
        });
    </script>
</body>
</html>
